<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
		<link rel="stylesheet" href="style.css" media="screen">
		<s:head theme="ajax" debug="false"/>
		<script type="text/javascript">
			dojo.event.topic.subscribe("/save", function(data, type, request) {
			    if(type == "load") {
					dojo.byId("id").value = "";
					dojo.byId("name").value = "";
					dojo.byId("country").value = "";
				}
			});

			dojo.event.topic.subscribe("/edit", function(data, type, request) {
			    if(type == "before") {
					var id = data.split("_")[1];

					var tr = dojo.byId("row_"+id);
					var tds = tr.getElementsByTagName("td");

					dojo.byId("id").value = id;
					dojo.byId("name").value = dojo.string.trim(dojo.dom.textContent(tds[0]));
					dojo.byId("country").value = dojo.string.trim(dojo.dom.textContent(tds[1]));
				}
			});
		</script>
	</head>
<body>

		<s:url action="list" id="descrsUrl"/>
		<s:action name="list"></s:action>
		<s:if test="brands.size > 0">
    		<s:iterator value="brands">
    			<s:property value="id"/>
    		</s:iterator>
    	</s:if>
		<div class="box">				

			<div class="lb">
			<div class="rb">
			<div class="bb"><div class="blc"><div class="brc">
			<div class="tb"><div class="tlc"><div class="trc">
					
			<div id="content">	
				<div style="text-align: right;">
    			<s:a theme="ajax" notifyTopics="/refresh">Refresh</s:a>
    		</div>
    		<s:div id="brands" theme="ajax" href="%{descrsUrl}" loadingText="Loading..." listenTopics="/refresh"/>
    		<br/>
    		
    		<s:a href="index.jsp">Ajouter une marque</s:a>
						
			</div>
			</div></div></div></div>
			</div></div></div></div>
		</div>
		
</body>